<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/include.jsp"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>IRD Web Applications</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" />

<!-- jquery-->
<!--[if lt IE 9]>
<script type="text/javascript" src="${jqueryuiPath}/jquery-1.10.2.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script type="text/javascript" src="${easyuiPath}/jquery.min.js"></script>
<!--<![endif]-->

<!-- easyui-->
<link rel="stylesheet" type="text/css" href="${easyuiPath}/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${easyuiPath}/themes/icon.css">
<link rel="stylesheet" type="text/css" href="${easyuiPath}/demo/demo.css">
<script type="text/javascript" src="${easyuiPath}/jquery.easyui.min.js"></script>

<script type="text/javascript" src="${easyuiPath}/plugins/jquery.serializeJSON.js"></script>

<script type="text/javascript" src="${jsPath}/hotkey.js"></script>
<script type="text/javascript" src="${jsPath}/tools.js"></script>

<script type="text/javascript">
$(function() {
	//esc:27, f1-f12: 112-123
	var keyCodeArr = [27, 112, 113, "114","115","116","117","118","119","120","121","122","123"];
	//disable all hotkey
	$(function() {
		document.onkeydown = function (event) {
			switch (event.keyCode){
				case 112 :
				document.onhelp = function() {return(false);}
				window.onhelp = function() {return(false);}
			}
			
			if(keyCodeArr.indexOf(event.keyCode) > -1){
				alert("true");
				event.stopPropagation();
		        event.preventDefault();
		        //alert(event.keyCode);
		        event.keyCode = 0;
		        return false;
			}
			else{
				alert("false");
			}
			
		};
		
	});
});

function bind(){
	$(document).bind('keydown', 'esc', function(){ alert('esc');});
	$(document).bind('keydown', 'f1', function(){ alert('f1');});
	$(document).bind('keydown', 'f2', function(){ alert('f2');});
	$(document).bind('keydown', 'f3', function(){ alert('f3');});
	$(document).bind('keydown', 'f12', function(){ alert('f12');});
}

function unbind(){
	$(document).unbind('keydown');
}
</script>

</head>

<body>
testbbb
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="bind()">bind</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="unbind()">unbind</a>
</body>
</html>